<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    public $fillable = [
        'name',
        'email',
        'phone',
        'password',
//        'nickname',
//        'avatar_url',
        'sex',
        'province',
        'city',
        'district',
        'address',
        'company_name',
        'tel',
        'contact_tel',
        'contact_name',
        'qq',
        'wechat',
        'type',
        'status',
        'position',
        'parent_id',
        'lately_titles',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function likes()
    {
        return $this->belongsToMany('App\Models\Goods','goods_like');
    }

    public function customers()
    {
        return $this->hasMany('App\User','parent_id');
    }

    public function roles()
    {
        return $this->belongsToMany('App\Models\Role');
    }
}
